<?php
defined('BASEPATH') or exit('No direct script access allowed');

class Alipay extends CI_Controller {
	public function __construct() {
		parent::__construct();
	}

	public function index() {
		$orderid = $this->uri->segment ( 4 );
		//$orderid = $this->input->post ( 'id' );
		$this->load->model ( 'order_model' );
		$data['order'] = $this->order_model->load ( $orderid );
		/*$userid=$this->session->userdata('id');
		$this->load->model ( 'user_model' );
		$data['user'] = $this->user_model->load ( $userid );*/
		$userid=$this->session->userdata('id');
		$data['num']=$this->order_model->find_orders_num ( $userid );//暂时没用
		$this -> load -> view('alipay/index',$data);
	}
	/**
	 * 收货以后的付款
	 */
	public function pay() {
		$orderid = $this->uri->segment ( 4 );
		$this->load->model ( 'order_model' );
		$data['order'] = $this->order_model->load ( $orderid );
		$this -> load -> view('alipay/pay',$data);
	}
	/*
	public function notify_url() {
		return "success";
		die();
	}
	
	public function call_back_url() {
		$this -> load -> view('alipay/test');
		$result=$this->input->get('result');
		if($result=='success'){
			$orderno=$this->input->get('out_trade_no');
			$neworder= array (
				'state' => 1
			);
			$this->load->model ( 'order_model' );
			$order=$this->order_model->find_by_orderno($orderno);
			if($this->order_model->update($order['id'],$neworder)){
				$data['orderid']=$order['id'];
				$this -> load -> view('alipay/success',$data);
			}
		}else{
			
		}
	}*/

}
